<?php

namespace app\admin\controller\circle;

use app\common\controller\Backend;

/**
 * 文章管理
 *
 * @icon fa fa-circle-o
 */
class CircleList extends Backend
{

    /**
     * Type模型对象
     * @var \app\admin\model\circle\CircleList
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\circle\CircleList;


        //获取圈子类型列表
        $TypeModel = new \app\admin\model\circle\Type();
        $typeList = $TypeModel->order("id asc")->select();
        $this->assign("typeList",$typeList);
        $typearr = $TypeModel->order("id asc")->column('name', 'id');
        $this->assignconfig("typearr",$typearr);
        $this->view->assign("typearr", $typearr);

        //获取用户列表
        $userModel = new \app\common\model\User();
        $userList = $userModel->order("id asc")->field('nickname,id')->select();
        $this->assign("userList",$userList);

        $userarr = $userModel->order("id asc")->column('nickname', 'id');
        $this->assignconfig("userarr",$userarr);
        $this->view->assign("userarr", $userarr);

        //获取学校列表
        $schoolModel = new \app\admin\model\main\School();
        $schoolList = $schoolModel->order("id asc")->select();
        $this->assign("schoolList",$schoolList);
        $schoolarr = $schoolModel->order("id asc")->column('name', 'id');
        $this->assignconfig("schoolarr",$schoolarr);
        $this->view->assign("schoolarr", $schoolarr);


        $this->assignconfig("typeList",$typeList);
        $this->assignconfig("schoolList",$schoolList);


        $TypeextendModel = new \app\admin\model\circle\CircleTypeExtend();
        $Typeextendarr = $TypeextendModel->column('title', 'code');
//        var_dump($Typeextendarr);die();
        $this->assignconfig("typeextendarr",$Typeextendarr);
        $this->view->assign("typeextendarr", $Typeextendarr);

////        var_dump($userList);die();
//
//        $this->view->assign("categoryList", \app\common\model\Attachment::getCategoryList());
//        $this->assignconfig("categoryList", \app\common\model\Attachment::getCategoryList());

    }

}
